#include "definiciones.h"

typedef struct{
	char idDesc[16];
}char16;

typedef struct{
	int32_t numClus;
	char* data;

}t_vec_clusters;
//////////////////LISTAS//////////////////

typedef struct{
		void *dato;
		struct TNodoLista *Next;
}TNodoLista;

typedef struct {
		TNodoLista *Nodo;
		uint32_t cant_elem;
}Tentrada;

//////////////////ESTRUCTURAS FAT32//////////////////

typedef struct {

		uint16_t bytesPorSector;
		uint8_t  sectorPerCluster;
		uint16_t reservedSectorCount;
		uint8_t  numeroFATs;
		uint32_t totalSectos32;
		uint32_t sectorPerFAT32;
		uint32_t rootCluster;
		uint16_t rootFSInfo;
}t_boot;


typedef struct {
		uint8_t  nombre[11];
		uint8_t  attributes;
		uint8_t  reversed;
		uint8_t  creationTimeMs;
		uint16_t creationTime;
		uint16_t creationDate;
		uint16_t lastAccessDate;
		uint16_t firstClusterHi;
		uint16_t lastModifiedTime;
		uint16_t lastModifiedDate;
		uint16_t firstClusterLow;
		uint32_t fileSize;
}t_entrada;

typedef struct {
		uint8_t  sequenceNumber;
		uint16_t nombrePart1[5];
		uint8_t  attributes;
		uint8_t  reserved;
		uint8_t  checksum;
		uint16_t nombrePart2[6];
		uint16_t firstClusterNumber;
		uint16_t nombrePart3[2];
}t_entrada_longfile;

typedef struct{
	char *cluster;
	uint32_t numClus;
	uint32_t escrito;
	uint32_t cont;
	struct t_cache *next;
}t_cache;

typedef struct{
	char cluster[TAM_CLUSTER];
	uint32_t numClus;
	uint32_t escrito;
}t_cache_global;



typedef struct {

		uint8_t  tipo;
		char	 nombre[TAM_MAX_NOMBRE];
		int32_t	 largoNombre;
		t_fecha  creationDate;
		t_hora   creationTime;
		uint32_t primerCluster;
		uint32_t clusterDirectorio;
		uint32_t numeroEntradaEnDir;
		Tentrada *contenido; //se usa solo si es un dir
		uint32_t tamanio; //se usa si es un archivo
		t_cache  *cache;
		int32_t  cantAperturas;
} t_elemento;


typedef struct {
		t_boot 			    bootsector;
		uint32_t			*tablaFAT;
		uint32_t			cantEntradasEnFAT;
		uint32_t			tamFatBytes;
		uint32_t			tamCluster;
		uint32_t			entradasPorCluster;
		Tentrada			*rootDirectoryContent;
} t_fs;


typedef struct{
	int32_t Sock;
	int32_t uso;
}t_pool;
